//
//  ViewController.m
//  heheda
//
//  Created by admid on 16-5-26.
//  Copyright (c) 2016年 wyr_oc. All rights reserved.
//

#import "ViewController.h"
#import "TwoViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    self.title = @"屌丝✈️";//标题编辑
    
    //self.view.backgroundColor = [UIColor whiteColor];//改背景颜色
    
    
    
    
    //self.tableView.bounces= NO;//控制上拉下拉的那个弹簧,使它不能拖
    
    self.refreshControl = [UIRefreshControl new];//向下拉刷新
    self.refreshControl.tintColor=[UIColor redColor];//改变刷新图标的颜色
    
    self.refreshControl.attributedTitle = [[NSAttributedString alloc]initWithString:@"转🐶转" attributes:@{NSForegroundColorAttributeName:[UIColor blackColor]}];
    //刷新图标下写的文字的颜色
    
    /*self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc]initWithTitle:@"停止刷新" style:UIBarButtonItemStylePlain target:self action:@selector(onClick:)];*/
    
    
    //在导航栏右侧设置一个自定义的文字按钮
    self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(onClick:)];
     
     //是刷新停止按钮为退出图标，实现与上面同样的
    
    //self.navigationItem
    
  /* UIImageView *iv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"4"]];
    self.navigationItem.titleView = iv;*/
   //更改界面上端图标
}

-(void)onClick:(id)sender{
    [self.refreshControl endRefreshing];
}

-(NSInteger)tableView:(UITableView *)tableView  numberOfRowsInSection:(NSInteger)section{
    return 6;//改变此值就改变了表格的行数
}//制作出来的表格行数

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];//初始化并选择它的分格
    
    NSString *imgName = [NSString stringWithFormat:@"%ld",indexPath.row +1];
    //从0开始，每行＋1
    cell.imageView.image = [UIImage imageNamed:imgName];//添加图标,UIImage专门管理图片的一个类，imageView显示图片的一个类
    
    /*cell.imageView.layer.cornerRadius =18;//把图标切成圆圆的
    cell.imageView.clipsToBounds = YES;//要是没切成功，则需要这行
    */
    cell.textLabel.text = @"呵呵😄";
    
    cell.accessoryType =UITableViewCellAccessoryDisclosureIndicator;//让表格右边有箭头
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath{
    TwoViewController *con = [TwoViewController new];
    //ViewController *con = [ViewController new];//只是最简单的初始化
    [self.navigationController pushViewController:con animated:YES];//点进去无限弹出自己
    
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
